'''
Created on Mar 14, 2012

@author: root
'''

import os
import csv

class MenuBuilder:
    
    def build_Menu(self,title,menuFile): 
       
        os.system('clear')
        menuPath = "./conf/menus/"
        menuFullPath = menuPath + menuFile
        print "-----------------------------------"
        print title
        print "-----------------------------------"
        menuCnt = 0
        for row in csv.DictReader(open(menuFullPath), 'menuItem'.split()):
            menuCnt = menuCnt + 1
            print str(menuCnt) +") "+row['menuItem']
        menuInput = raw_input("\nEnter your choice : ")
        if menuInput == "":
            choice=0
        else:
            choice = int(menuInput)
        return {'choice':choice,'menuCnt':menuCnt}

#